from datetime import datetime

from common.utils.config_util import IniConfig


class TestVar:
    # 随机接口名
    api_name = '测试环境变量' + '(' + datetime.now().strftime('%F %T.%f')[:-3] + ')'


class DevVar:
    # 随机接口名
    api_name = '开发环境变量' + '(' + datetime.now().strftime('%F %T.%f')[:-3] + ')'


env_config = {
    "test": TestVar,
    "dev": DevVar
}


def get_variables(var):
    env = IniConfig.get_env()
    class_name = env_config[env]
    # 获取类所有属性，去除函数
    # attributes = [attr for attr in dir(class_name) if not callable(getattr(class_name, attr))]
    return getattr(class_name, var)


if __name__ == '__main__':
    print(get_variables('api_name'))
